﻿using ApiGateway;
using HttpApiGateway;
using HttpApiGateway.Model;
using RpcClient;
using RpcHelper.Validate;
using Wedonek.RpcStore.Gateway.Interface;
using Wedonek.RpcStore.Gateway.Model;
using Wedonek.RpcStore.Service.Model;

namespace Wedonek.RpcStore.Gateway.Controller
{
    /// <summary>
    /// 资源模块
    /// </summary>
    internal class ResourceModularController : ApiController
    {
        private readonly IResourceModularService _Service = null;

        public ResourceModularController(IResourceModularService service)
        {
            this._Service = service;
        }
        /// <summary>
        /// 获得系统类别下的资源模块
        /// </summary>
        /// <param name="systemTypeId"></param>
        /// <returns></returns>
        public BasicModular[] Gets([NumValidate("rpc.system.type.id.error", 1)] long systemTypeId)
        {
            return this._Service.Gets(systemTypeId);
        }
        /// <summary>
        /// 查询资源模块
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public PagingResult<ResourceModularData> Query(PagingParam<ModularQueryParam> param)
        {
            ResourceModularData[] list = this._Service.Query(param.Param, param.ToBasicPaging(), out long count);
            return new PagingResult<ResourceModularData>(list, count);
        }
        /// <summary>
        /// 设置资源模块备注
        /// </summary>
        /// <param name="param"></param>
        public void SetRemark(GuidParam<string> param)
        {
            this._Service.SetRemark(param.Id, param.Param);
        }
    }
}
